using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
namespace BusinessObjects.BO_GetObjects {
    public static class BO_portal_categories {
        public static DataTable SelectAll(int status) {
            try {
                usp_portal_categories_select_all entity = new usp_portal_categories_select_all();
                entity.STATUS = status;
                return BO_Actions<usp_portal_categories_select_all>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status) {
            try {
                usp_portal_categories_select_top entity = new usp_portal_categories_select_top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;
                return BO_Actions<usp_portal_categories_select_top>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable Search(int category_id) {
            try {
                usp_portal_categories_search entity = new usp_portal_categories_search();
                entity.CATEGORY_ID = category_id;

                return BO_Actions<usp_portal_categories_search>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status) {
            try {
                usp_portal_categories_select_paged entity = new usp_portal_categories_select_paged();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                return BO_Actions<usp_portal_categories_select_paged>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectByParentWithPaged(int parent_id, int startIndex, int pageCount, int status) {
            try {
                usp_portal_categories_select_by_parent_paged entity = new usp_portal_categories_select_by_parent_paged();
                entity.PARENT_ID = parent_id;
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                return BO_Actions<usp_portal_categories_select_by_parent_paged>.ExecuteAndReturnDataTable(entity);
            } catch(Exception ex) {
                throw ex;
            }
        }
        public static string Insert(int parent_id, int content_type_id, string short_category_name, string short_category_name_eng, string full_category_name, string full_category_name_eng, string thumb_icon, string short_category_description, string short_category_description_eng, string full_category_description, string full_category_description_eng, bool is_menu, int total_items, int order_display, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status) {
            try {
                usp_portal_categories_insert entity = new usp_portal_categories_insert();
                entity.PARENT_ID = parent_id;
                entity.CONTENT_TYPE_ID = content_type_id;
                entity.SHORT_CATEGORY_NAME = short_category_name;
                entity.SHORT_CATEGORY_NAME_ENG = short_category_name_eng;
                entity.FULL_CATEGORY_NAME = full_category_name;
                entity.FULL_CATEGORY_NAME_ENG = full_category_name_eng;
                entity.THUMB_ICON = thumb_icon;
                entity.SHORT_CATEGORY_DESCRIPTION = short_category_description;
                entity.SHORT_CATEGORY_DESCRIPTION_ENG = short_category_description_eng;
                entity.FULL_CATEGORY_DESCRIPTION = full_category_description;
                entity.FULL_CATEGORY_DESCRIPTION_ENG = full_category_description_eng;
                entity.IS_MENU = is_menu;
                entity.TOTAL_ITEMS = total_items;
                entity.ORDER_DISPLAY = order_display;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;

                return BO_Actions<usp_portal_categories_insert>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string Update(int category_id, int parent_id, int content_type_id, string short_category_name, string short_category_name_eng, string full_category_name, string full_category_name_eng, string thumb_icon, string short_category_description, string short_category_description_eng, string full_category_description, string full_category_description_eng, bool is_menu, int total_items, int order_display, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status) {
            try {
                usp_portal_categories_update entity = new usp_portal_categories_update();
                entity.CATEGORY_ID = category_id;
                entity.PARENT_ID = parent_id;
                entity.CONTENT_TYPE_ID = content_type_id;
                entity.SHORT_CATEGORY_NAME = short_category_name;
                entity.SHORT_CATEGORY_NAME_ENG = short_category_name_eng;
                entity.FULL_CATEGORY_NAME = full_category_name;
                entity.FULL_CATEGORY_NAME_ENG = full_category_name_eng;
                entity.THUMB_ICON = thumb_icon;
                entity.SHORT_CATEGORY_DESCRIPTION = short_category_description;
                entity.SHORT_CATEGORY_DESCRIPTION_ENG = short_category_description_eng;
                entity.FULL_CATEGORY_DESCRIPTION = full_category_description;
                entity.FULL_CATEGORY_DESCRIPTION_ENG = full_category_description_eng;
                entity.IS_MENU = is_menu;
                entity.TOTAL_ITEMS = total_items;
                entity.ORDER_DISPLAY = order_display;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;

                return BO_Actions<usp_portal_categories_update>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static bool Delete(string ids, string spliter, int delete_type) {
            try {
                usp_portal_categories_delete entity = new usp_portal_categories_delete();
                entity.IDS = ids;
                entity.SPLITER = spliter;
                entity.DELETE_TYPE = delete_type;

                return BO_Actions<usp_portal_categories_delete>.ExecuteAndReturnBooleanValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static bool Restore(int category_id) {
            try {
                usp_portal_categories_restore entity = new usp_portal_categories_restore();
                entity.CATEGORY_ID = category_id;

                return BO_Actions<usp_portal_categories_restore>.ExecuteAndReturnBooleanValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectAll() {
            try {
                usp_portal_categories_select_all_display entity = new usp_portal_categories_select_all_display();
                return BO_Actions<usp_portal_categories_select_all_display>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable Inside(int category_id) {
            try {
                usp_portal_categories_inside entity = new usp_portal_categories_inside();
                entity.CATEGORY_ID = category_id;
                return BO_Actions<usp_portal_categories_inside>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectByParent(int parent_id, int status) {
            try {
                usp_portal_categories_select_by_parent entity = new usp_portal_categories_select_by_parent();
                entity.PARENT_ID = parent_id;
                entity.STATUS = status;
                return BO_Actions<usp_portal_categories_select_by_parent>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectAdmin(int parent_id, int status, string keywords) {
            try {
                usp_portal_categories_select_admin entity = new usp_portal_categories_select_admin();
                entity.PARENT_ID = parent_id;
                entity.STATUS = status;
                entity.KEYWORDS = keywords;
                return BO_Actions<usp_portal_categories_select_admin>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string Update(int category_id, string full_category_name, bool is_menu, int order_display, string modify_by) {
            try {
                usp_portal_categories_update_tiny entity = new usp_portal_categories_update_tiny();
                entity.CATEGORY_ID = category_id;
                entity.FULL_CATEGORY_NAME = full_category_name;
                entity.IS_MENU = is_menu;
                entity.ORDER_DISPLAY = order_display;
                entity.MODIFY_BY = modify_by;
                return BO_Actions<usp_portal_categories_update_tiny>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static bool Order(string STRING) {
            try {
                usp_portal_categories_order entity = new usp_portal_categories_order();
                entity.STRING = STRING;
                return BO_Actions<usp_portal_categories_order>.ExecuteAndReturnBooleanValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable InsideContent(int category_id, string content_key) {
            try {
                usp_portal_categories_inside_content entity = new usp_portal_categories_inside_content();
                entity.CATEGORY_ID = category_id;
                entity.CONTENT_KEY = content_key;
                return BO_Actions<usp_portal_categories_inside_content>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable GetMenu(int parent_id) {
            try {
                usp_portal_categories_get_menu entity = new usp_portal_categories_get_menu();
                entity.PARENT_ID = parent_id;
                return BO_Actions<usp_portal_categories_get_menu>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectDepth(int category_id, int depth) {
            try {
                usp_portal_categories_select_by_depth entity = new usp_portal_categories_select_by_depth();
                entity.CATEGORY_ID = category_id;
                entity.DEPTH = depth;
                return BO_Actions<usp_portal_categories_select_by_depth>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectParentId(int category_id, int depth) {
            try {
                usp_portal_categories_select_parent_id entity = new usp_portal_categories_select_parent_id();
                entity.CATEGORY_ID = category_id;
                entity.DEPTH = depth;
                return BO_Actions<usp_portal_categories_select_parent_id>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string Depth(int category_id, int parent_id) {
            try {
                usp_portal_categories_select_depth entity = new usp_portal_categories_select_depth();
                entity.CATEGORY_ID = category_id;
                entity.PARENT_ID = parent_id;
                return BO_Actions<usp_portal_categories_select_depth>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
    }
}

